I first came across this 'poem' around 1970, when it was believed by many to be hundreds of years old. Turns out this was due to a misunderstanding.
The words were in fact written in the early 1920s by Max Ehrmann, a lawyer from the city of Terre Haute, Indiana. Ehrmann registered his work for a US copyright in 1927, using the opening words (no title), and it was published in 1933 by Michigan Tradesman magazine. Ehrmann distributed it later that year in the form of a Christmas card. He later wrote in his journal that an editor in Kansas had criticised his Desiderata; this is the earliest known use of the title by which the poem subsequently became known.
The poem was distributed to thousands of patients and soldiers during World War II by the American psychiatrist and poet Merrill Moore, who had been given it some time earlier by "a depressed woman".
Ehrmann died in 1945, and his widow published the work three years later in a collection of his poems. This version was one long prose paragraph, suggesting that earlier versions had been in the same form.
The text was widely distributed in poster form in the 1960s and 70s. Around 1960, the pastor of a church in Baltimore, Maryland, included it in a compilation of devotional materials that he prepared for his congregation. The compilation included the church's foundation date: "Old Saint Paul's Church, Baltimore AD 1692". Many readers subsequently took this to be the poem's place of origin, and its date of composition – hence the misunderstanding that I referred to in my first paragraph.
Despite Ehrmann's 1927 copyright, the poem has been the subject of several copyright disputes. According to Wikipedia, Ehrmann forfeited his US copyright by distributing copies without the required copyright notice, in 1933 and around (or some years before before) 1942.
© Haydn Thompson 2021